/*
 *
 *  Copyright (C) 2012-2024
 *  All rights reserved, Designed By 杭州连线客信息技术有限公司
 *  注意：
 *  本软件为杭州连线客信息技术有限公司开发研制，未经购买不得使用
 *  购买后可获得全部源代码（禁止转卖、分享、上传到码云、github等开源平台）
 *  一经发现盗用、分享等行为，将追究法律责任，后果自负
 *
 */

package com.lxk.finance.listener;

import cn.hutool.core.util.ObjectUtil;
import com.lxk.event.ums.UmsUserCreateEvent;
import com.lxk.finance.service.IAccUserAccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @author heyi
 * 2024/7/8
 */
@Component
@Slf4j
public class UserCreateEventListener {

    @Autowired
    private IAccUserAccountService accUserAccountService;


    @EventListener
    public void accountCreateEvent(UmsUserCreateEvent event) {
        Long userId = event.getUserId();
        String userType = event.getUserType();
        if (ObjectUtil.isNotNull(userId)) {
            accUserAccountService.registerAccount(userId, userType);
        }
    }

}
